import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'

Vue.use(VueRouter)
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
router.beforeEach((to,form,next)=>{
  var token=localStorage.getItem('token')
  if(to.path=='/down/dingdan' || to.path=='/down/my'){
    if(token){
      next()
    }else{
      router.push('/landing')
    }
  }else{
    next()
  }
})
export default router
